import { bindable, containerless } from 'aurelia-framework';
import 'timeago.js';
let tg = timeago();
import search from 'common/common-search';

@containerless
export class EmTaskTopMenu {

    loginUser = nsCtx.loginUser;

    /**
     * 构造函数
     */
    constructor() {}
    
    /**
     * 当数据绑定引擎从视图解除绑定时被调用
     */
    unbind() {
    }

    /**
     * 当视图被附加到DOM中时被调用
     */
    attached() {
        $(this.logoRef).on('mouseenter', (event) => {
            $(this.logoRef).animateCss('flip');
        });
    }

    userEditHandler() {
        this.userEditMd.show();
    }

    logoutHandler() {
        $.post('/admin/logout').always(() => {
            utils.redirect2Login();
        });
    }

    createHandler() {
        this.taskCreateModal.show();
    }

}
